
    <?php

session_start();
if($_POST["ma"]==$_SESSION["verification"])


{

	
	
$time=date("Y-m-d H:i:s");
$con = mysql_connect("localhost","root","");

if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
	
// Create database


// Create table in my_db database
mysql_select_db("book", $con);
mysql_query("SET NAMES UTF8");
$sql="INSERT INTO mybook (username,usercomment,sendtime)
VALUES
('$_POST[username]','$_POST[usercomment]','$time')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "您的反馈已经发表并提交成功";



$result = mysql_query("SELECT * FROM mybook ORDER BY sendtime DESC");



while($row = mysql_fetch_array($result))
  {
  echo "<div class='comment' >";
  echo "<p style='border:1px solid; background:#FFFFFF; color:#00CC33; '>用户：" . $row['username'] . "</p>";
  echo  "<span>发表于".$row['sendtime']."</span>";
  echo "<p>" . $row['usercomment'] . "</p>";
  echo "</div>";
  }



mysql_close($con);

}


else {echo "验证码输入错误";
}

?>

	
	
	